import web


class defaultcontroller(object):

    def POST(self, path):
        web.header("Access-Control-Allow-Origin", "*")

    def GET(self, path):
        web.header("Access-Control-Allow-Origin", "*")
        print "path---", path
        if not path:
            path = 'commons/controller.html'
        elif path == 'favicon.ico':
            return ""
        try:
            import os
            print os.path.abspath(".")
            if 'lay' in path and path.startswith('css/modules'):
                path = './pages/helios/js/lib/layui/dist/' + path
            elif 'output' in path and path.startswith('output/logs'):
                path = './' + path
            else:
                path = './pages/helios/' + path
            print "path end", path
            return open(path).read()
        except IOError, e:
            print e.message
